package com.bjsdzk.collector.entity.agreement;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

public class SendCmd implements Comparable<SendCmd>, Serializable {
	@Setter
	@Getter
	private int priority;
	@Setter
	@Getter
	private boolean callback =false ;
	@Setter
	@Getter
	private boolean callbackPlatForm =true ;
	@Setter
	@Getter
	private String cmdPK  ;
	@Setter
	@Getter
	private int sendType ;//0byte 1string
	@Setter
	@Getter
	private String source ;
	@Setter
	@Getter
	private String messageId ;
	@Setter
	@Getter
	private String deviceHex ;
	@Setter
	@Getter
	private int port ;
	@Setter
	@Getter
	private String cmd;
	@Setter
	@Getter
	private boolean isSave=false;
	@Setter
	@Getter
	private boolean online=true;
	@Setter
	@Getter
	private Integer deviceAddr ;
	private boolean instantMessage = true ;


	public boolean getInstantMessage() {
		return instantMessage;
	}

	public void setInstantMessage(boolean instantMessage) {
		this.instantMessage = instantMessage;
	}

	@Override
	public int compareTo(SendCmd o) {
		return   o.priority - this.priority;

	}

	public SendCmd(int sendType, String deviceHex, String cmd) {
		this.sendType = sendType;
		this.deviceHex = deviceHex;
		this.cmd = cmd;
	}

	public SendCmd(int priority, int sendType, String cmd, String deviceHex) {
		this.priority = priority;
		this.sendType = sendType;
		this.cmd = cmd;
		this.deviceHex = deviceHex;
	}

	public SendCmd(int priority, String cmdPK, int sendType, String source, String messageId, String deviceHex, int port, String cmd) {
		this.priority = priority;
		this.cmdPK = cmdPK;
		this.sendType = sendType;
		this.source = source;
		this.messageId = messageId;
		this.deviceHex = deviceHex;
		this.port = port;
		this.cmd = cmd;
	}

	public SendCmd(int priority, String cmdPK, int sendType, String source, String messageId, String deviceHex, int port, String cmd,boolean isSave, boolean callback) {
		this.priority = priority;
		this.cmdPK = cmdPK;
		this.sendType = sendType;
		this.source = source;
		this.messageId = messageId;
		this.deviceHex = deviceHex;
		this.port = port;
		this.cmd = cmd;
		this.isSave = isSave;
		this.callback = callback;
	}

	public SendCmd(int priority, boolean callback, String cmdPK, int sendType, String source, String messageId, int port, String cmd) {
		this.priority = priority;
		this.callback = callback;
		this.cmdPK = cmdPK;
		this.sendType = sendType;
		this.source = source;
		this.messageId = messageId;
		this.port = port;
		this.cmd = cmd;
	}

	public SendCmd(int priority, boolean callback, String cmdPK, int sendType, String source, String messageId, int port, String cmd,String deviceHex) {
		this.priority = priority;
		this.callback = callback;
		this.cmdPK = cmdPK;
		this.sendType = sendType;
		this.source = source;
		this.messageId = messageId;
		this.port = port;
		this.cmd = cmd;
		this.deviceHex = deviceHex;
	}

	public SendCmd(int priority, boolean callback, String cmdPK, int sendType, String source, String messageId, int port, String cmd,String deviceHex,Integer deviceAddr) {
		this.priority = priority;
		this.callback = callback;
		this.cmdPK = cmdPK;
		this.sendType = sendType;
		this.source = source;
		this.messageId = messageId;
		this.port = port;
		this.cmd = cmd;
		this.deviceHex = deviceHex;
		this.deviceAddr = deviceAddr;
	}

}